package com.nti56.springboot.web;

import com.nti56.springboot.cache.BaseDataCache;
import com.nti56.springboot.utils.SpringContext;

import javax.servlet.jsp.JspContext;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.SimpleTagSupport;
import java.io.IOException;

/**
 * 自定义标签
 * @author szq
 *
 */
public class DictTag extends SimpleTagSupport {
	
	
	
	private String dictCode;

	public void setDictCode(String dictCode) {
		this.dictCode = dictCode;
	}

	public void doTag() throws JspException, IOException {		
		JspContext ctx = getJspContext();
		JspWriter out = ctx.getOut();
		BaseDataCache baseDataCache = SpringContext.getBean(BaseDataCache.class);
		String items = baseDataCache.getDictItem(dictCode);
		out.print(items);
	}

}
